﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SlimDX;

namespace SGX
{
    class TransformNode : MatrixNode
    {
        public TransformNode(ref Matrix transform)
            : base(ref transform)
        {
        }

        public TransformNode()
        {
        }

        public void SetTransform(ref Matrix matrix)
        {
            SetMatrix(ref matrix);
        }

        public void GetTransform(out Matrix matrix)
        {
            GetMatrix(out matrix);
        }

        public override void PreRender(Scene scene)
        {
            base.PreRender(scene);
            scene.MatrixStack.Push();

            Matrix m;
            GetTransform(out m);
            scene.MatrixStack.MultiplyMatrixLocal(m);
        }

        public override void PostRender(Scene scene)
        {
            base.PostRender(scene);
            scene.MatrixStack.Pop();
        }
    }
}